<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button>点击打开界面</button>
    <button>点击跳转</button>
    <button>点击关闭界面</button>

    <script>
      var btn1 = document.querySelectorAll("button")[0];
      var btn2 = document.querySelectorAll("button")[1];
      var btn3 = document.querySelectorAll("button")[2];
      btn1.onclick = function () {
        window.open(
          "https://www.bilibili.com/?spm_id_from=333.937.b_696e7465726e6174696f6e616c486561646572.1"
        ); //_blank打开 即在新界面展开
      };
      btn2.onclick = function () {
        window.location.href =
          "https://www.bilibili.com/?spm_id_from=333.937.b_696e7465726e6174696f6e616c486561646572.1";
      };//_self打开 即在当前界面展开
      btn3.onclick = function () {
        window.close();
        //关闭当前界面
      };
    </script>
  </body>
</html>
